package com.huatai.range.controller;

import com.alibaba.fastjson.JSONObject;
import com.huatai.common.api.R;
import com.huatai.range.query.TrialRangeQuery;
import com.huatai.range.service.TrialRangeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * @ClassName TrialRangeController
 * @Description TODO
 * @Author luoxc
 * @Date 2023/5/5 11:36
 * @Version 1.0
 */
@RestController
@RequestMapping("range")
@Api(tags = "区域轮廓", value = "区域轮廓")
public class TrialRangeController {

	@Autowired
	private TrialRangeService trialRangeService;

	@GetMapping("listByTrialId")
	@ApiOperation(value = "试验id查询GIS数据", notes = "试验id查询GIS数据")
	public R listByTrialId(@ApiParam(name = "trialId", value = "试验id", required = true) @RequestParam("trialId") String trialId) {
		return R.data(trialRangeService.listByTrialId(trialId));
	}

	/*@PostMapping("allByTrialId")
	@ApiOperation(value = "试验id查询GIS数据(壹瞰思)", notes = "试验id查询GIS数据(壹瞰思)")
	public Object allByTrialId(@ApiParam(name = "trialId", value = "试验id", required = true) @RequestParam("trialId") String trialId) {
		return trialRangeService.allByTrialId(trialId);
	}*/

	@PostMapping("listByTrialIdAndTabType")
	@ApiOperation(value = "试验id和表类型查询GIS数据(壹瞰思)", notes = "试验id和表类型查询GIS数据(壹瞰思)")
	public R allByTrialId(@RequestBody @Valid TrialRangeQuery trialRangeQuery) {
		return R.data(trialRangeService.listByTrialIdAndTabType(trialRangeQuery));
	}


}
